﻿<?xml version="1.0" encoding="utf-8"?>
<Window
    x:Class="Automator.Runtime.Wizards.DbWizard" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:aw="clr-namespace:AvalonWizard;assembly=AvalonWizard"
    xmlns:sql="clr-namespace:System.Data.SqlClient;assembly=System.Data"
    Title="Configure SQL Server Connection"
    Width="500"
    Height="320"
    ResizeMode="NoResize"
    ShowInTaskbar="False"
    ShowActivated="True"
    WindowStartupLocation="CenterOwner">
    <Grid>
        <aw:Wizard
            x:Name="wizard"
            WizardStyle="Auto"
            aw:Designer.PageIndex="0">
            <aw:Wizard.Resources>
                <Style
                    TargetType="aw:WizardPage">
                    <Setter
                        Property="Padding"
                        Value="14" />
                </Style>
            </aw:Wizard.Resources>
            <aw:WizardPage
                Header="Step 1: SQL Server instance and database">
                <ScrollViewer VerticalScrollBarVisibility="Auto">
                    <Grid
                    Margin="8">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition
                            Width="Auto" />
                            <ColumnDefinition
                            Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition
                            Height="Auto" />
                            <RowDefinition
                            Height="Auto" />
                        </Grid.RowDefinitions>
                        <TextBlock
                        Margin="8"
                        VerticalAlignment="Center"
                        Text="Server:"
                        Grid.Row="0"
                        Grid.Column="0" />
                        <TextBox
                        Margin="0,4,0,4"
                        VerticalContentAlignment="Center"
                        x:Name="edtDbServer"
                        TabIndex="0"
                        Grid.Row="0"
                        Grid.Column="1" />
                        <TextBlock
                        Margin="8"
                        VerticalAlignment="Center"
                        Text="Database:"
                        Grid.Row="1"
                        Grid.Column="0" />
                        <TextBox
                        Margin="0,4,0,4"
                        VerticalContentAlignment="Center"
                        x:Name="edtDbCatalog"
                        TabIndex="1"
                        Grid.Row="1"
                        Grid.Column="1" />
                    </Grid>
                </ScrollViewer>
            </aw:WizardPage>
            <aw:WizardPage
                Header="Step 2: Authentication">
                <ScrollViewer VerticalScrollBarVisibility="Auto">
                    <Grid
                    Margin="8">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition
                            Width="Auto" />
                            <ColumnDefinition
                            Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition
                            Height="Auto" />
                            <RowDefinition
                            Height="Auto" />
                            <RowDefinition
                            Height="Auto" />
                            <RowDefinition
                            Height="Auto" />
                        </Grid.RowDefinitions>
                        <RadioButton
                        Content="Windows Authentication"
                        IsChecked="True"
                        Grid.Row="0"
                        Grid.Column="0"
                        Grid.ColumnSpan="2"
                        Margin="8"
                        Click="DbRadioButton_Click"
                        x:Name="rbDbWindows"
                        TabIndex="2" />
                        <RadioButton
                        Content="SQL Server Authentication"
                        IsChecked="False"
                        Grid.Row="1"
                        Grid.Column="0"
                        Grid.ColumnSpan="2"
                        Margin="8"
                        Click="DbRadioButton_Click"
                        x:Name="rbDbSqlServer"
                        TabIndex="3" />
                        <TextBlock
                        Margin="8"
                        VerticalAlignment="Center"
                        Text="Username:"
                        Grid.Row="2"
                        Grid.Column="0" />
                        <TextBox
                        Margin="0,4,0,4"
                        VerticalContentAlignment="Center"
                        x:Name="edtDbLogin"
                        TabIndex="4"
                        Grid.Row="2"
                        Grid.Column="1"
                        IsEnabled="False" />
                        <TextBlock
                        Margin="8"
                        VerticalAlignment="Center"
                        Text="Password:"
                        Grid.Row="3"
                        Grid.Column="0" />
                        <PasswordBox
                        Margin="0,4,0,4"
                        VerticalContentAlignment="Center"
                        x:Name="edtDbPassword"
                        TabIndex="5"
                        Grid.Row="3"
                        Grid.Column="1"
                        IsEnabled="False" />
                    </Grid>
                </ScrollViewer>
            </aw:WizardPage>
            <aw:WizardPage Header="Step 3: Summary" x:Name="pgSummary">
                <ScrollViewer VerticalScrollBarVisibility="Auto">
                    <Grid Margin="8">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <TextBox IsReadOnly="True" IsReadOnlyCaretVisible="False" x:Name="edtConnString" Grid.Row="0"
                        TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" />
                        <StackPanel
                        Margin="0,16,8,8"
                        Orientation="Horizontal"
                        Grid.Row="1">
                            <Button
                            Padding="4"
                            Content="Test Connection"
                            x:Name="btnTestConnection"
                            Margin="0,0,8,0"
                            TabIndex="6"
                            Click="BtnTestConnection_Click" />
                            <Button
                            Padding="4"
                            Content="Create Schema"
                            x:Name="btnCreateSchema"
                            Margin="0,0,8,0"
                            TabIndex="7"
                            Click="BtnCreateSchema_Click" />
                        </StackPanel>
                    </Grid>
                </ScrollViewer>
            </aw:WizardPage>
        </aw:Wizard>
    </Grid>
</Window>